/**
 * 将时间转换成更为清晰的文字说明
 * @param {Number} date 需要转换的时间戳
 */

export const timeTransform = (date) => {
  let currentDate = new Date(date)
  let differenceDate = new Date().getTime() - date
  if (differenceDate < 60 * 1000) {
    currentDate = (differenceDate / 1000).toFixed(0) + '秒前'
  } else if (differenceDate < 60 * 60 * 1000) {
    currentDate = (differenceDate / 60 / 1000).toFixed(0) + '分钟前'
  } else if (differenceDate < 60 * 60 * 24 * 1000) {
    currentDate = (differenceDate / 60 / 60 / 1000).toFixed(0) + '小时前'
  } else if (differenceDate < 60 * 60 * 24 * 10 * 1000) {
    currentDate = (differenceDate / 60 / 60 / 24 / 1000).toFixed(0) + '天前'
  } else {
    currentDate = currentDate.getFullYear() + '年' + (currentDate.getMonth() + 1) + '月' + currentDate.getDate() + '日'
  }
  return currentDate
}